import request from '@/utils/request'
import { downloadAction } from '@/api/requestEvents'

//获取课题分页
export function topicPage(params: any) {
  return request({
    url: '/project/topic/page',
    method: 'get',
    params,
  })
}

//获取课题名称分页
export function topicNamePage(params: any) {
  return request({
    url: '/project/topic/topicNamePage',
    method: 'get',
    params,
  })
}

//立项建议列表上报
export function createTopic(data: any) {
  return request({
    url: '/project/topic/create',
    method: 'post',
    data,
  })
}

//查询立项建议详情
export function getTopicDetail(params: any) {
  return request({
    url: '/project/topic/get',
    method: 'get',
    params,
  })
}

//更新课题
export function updateTopic(data: any) {
  return request({
    url: '/project/topic/update',
    method: 'put',
    data,
  })
}

//立项材料上传/立项建立终审
export function uploadTopic(data: any) {
  return request({
    url: '/project/topic/upload-certification-materials',
    method: 'put',
    data,
  })
}

//导出课题 Excel
export function exportTopic(params: any) {
  downloadAction(
    '/project/topic/export-excel',
    'get',
    params,
    '立项建议列表.xls'
  )
}
